package utils

// StringHashCode
// from java: java string hashcode
func StringHashCode(str string) int32 {
	h := int32(0)
	len := len(str)

	if h == 0 && len > 0 {
		off := 0
		val := []rune(str)

		for i := 0; i < len; i++ {
			h = 31*h + int32(val[off])
			off++
		}
	}

	return h
}
